import Vue from 'vue'
import Router from 'vue-router'

// 页面懒加载
const Home = () => import('../views/home/Home')
const Catalogue = () => import('../views/catalogue/Catalogue')
const Cart = () => import('../views/shoppingcart/Cart')
const Profile = () => import('../views/profile/Profile')

// 安装插件
Vue.use(Router)

//创建路由对象 
const routes = [
  {
   path: '',
   redirect: '/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    path: '/catalogue',
    component: Catalogue
  },
  {
    path: '/shoppingcart',
    component: Cart
  },
  {
    path: '/profile',
    component: Profile
  },
]
export default new Router({
  routes,
  // cli2默认用前端路由hash的实现方法,现在将hash方法改为history方法,history要加引号,可消去url中的#
  mode: "history",
})